<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> test </title>

    <script src="/static/jquery-3.6.0.min.js"></script>

</head>
<body>
********put********<br/>
<form action="/rest/put/100/李四" method="post">
    <input type="hidden" name="_method" value="PUT" />
    密码：<input type="text" name="password">
    <input type="submit" value="提交PUT">
</form>
********delete********<br/>
<form action="/rest/delete/100/李四" method="post">
    <input type="hidden" name="_method" value="DELETE" />
    <input type="submit" value="提交DELETE">
</form>

<br/>
********ajax put********<br/>
<button id="ajaxPut">Ajax PUT</button>
</body>

<script>
    $(function(){
        $("#ajaxPut").click(function(){
            var data = {};
            data['id'] = 1;
            data['goodsName'] = '华为手机';
            $.ajax({
                type:'put',
                url:'/rest/ajax/put/100/张三',
                data:JSON.stringify(data),//data是json对象 转换为字符串
                dataType:'text',//预期服务器返回的类型
                contentType:'application/json',//发送给服务器的类型
                success:function(ret){
                    console.log(ret)
                }
            })

        })
    })
</script>

</html>
